//
//  WSVisitorController.swift
//  WSWeiBo01
//
//  Created by 李维顺 on 16/7/12.
//  Copyright © 2016年 liweishun. All rights reserved.
//

import UIKit

class WSVisitorController: UITableViewController {

    
    var isLogin: Bool = false
    
    
    var visitorView :WSVisitorView?
    override func loadView() {
        if isLogin {
            super.loadView()
        } else {
             visitorView = WSVisitorView()
            //  使用[weak self]解决闭包循环引用
            visitorView?.loginClosure = { [weak self] in
                print(self)
            }
            
//            visitorView.backgroundColor = UIColor.redColor()
            view = visitorView
            
            setuiNavUI()
        }
    }
    
    
    private func setuiNavUI() {
//        let button = UIButton()
//        //设置字体和颜色
//        button.setTitle("注册", forState: .Normal)
//        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
//        button.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Highlighted)
//        
//        button.titleLabel?.font = UIFont.systemFontOfSize(15)
//        button.sizeToFit()
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册",target: self, action: "registerAction")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录",target: self, action: "loginAction")
    }
    
    
    @objc private func registerAction() {
        print("点击了注册按钮")
    }
    
    @objc private func loginAction() {
        print("点击了登录按钮")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

       
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

   

   

}
